X-Git-Url: http://git.cyclocoop.org//%22http:/%22.attribut_html%28%24lesurls%5B%24numero%5D%29.%22/%22?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialImport.php;h=e2bc62903c25eaf88b09604fb59295e18f1de184;hb=70e760ee4e37edad1be0573b37c17fe6899e4806;hp=4cdf6ddf51c7eff2c8c65b22a2e646df32b46b4a;hpb=9160785c6fb478a929502372ce00a0560f0de936;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 4cdf6ddf51..e2bc62903c 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -42,6 +42,7 @@ class SpecialImport extends SpecialPage { private $history = true; private $includeTemplates = false; private $pageLinkDepth; + private $importSources; /** * Constructor @@ -66,6 +67,9 @@ class SpecialImport extends SpecialPage { $this->getOutput()->addModules( 'mediawiki.special.import' ); + $this->importSources = $this->getConfig()->get( 'ImportSources' ); + Hooks::run( 'ImportSources', array( &$this->importSources ) ); + $user = $this->getUser(); if ( !$user->isAllowedAny( 'import', 'importupload' ) ) { throw new PermissionsError( 'import' ); @@ -136,16 +140,17 @@ class SpecialImport extends SpecialPage { } $this->interwiki = $this->fullInterwikiPrefix = $request->getVal( 'interwiki' ); // does this interwiki have subprojects? - $importSources = $this->getConfig()->get( 'ImportSources' ); - $hasSubprojects = array_key_exists( $this->interwiki, $importSources ); - if ( !$hasSubprojects && !in_array( $this->interwiki, $importSources ) ) { + $hasSubprojects = array_key_exists( $this->interwiki, $this->importSources ); + if ( !$hasSubprojects && !in_array( $this->interwiki, $this->importSources ) ) { $source = Status::newFatal( "import-invalid-interwiki" ); } else { if ( $hasSubprojects ) { $this->subproject = $request->getVal( 'subproject' ); $this->fullInterwikiPrefix .= ':' . $request->getVal( 'subproject' ); } - if ( $hasSubprojects && !in_array( $this->subproject, $importSources[$this->interwiki] ) ) { + if ( $hasSubprojects && + !in_array( $this->subproject, $this->importSources[$this->interwiki] ) + ) { $source = Status::newFatal( "import-invalid-interwiki" ); } else { $this->history = $request->getCheck( 'interwikiHistory' ); @@ -306,7 +311,6 @@ class SpecialImport extends SpecialPage { $user = $this->getUser(); $out = $this->getOutput(); $this->addHelpLink( '//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true ); - $importSources = $this->getConfig()->get( 'ImportSources' ); if ( $user->isAllowed( 'importupload' ) ) { $mappingSelection = $this->getMappingFormPart( 'upload' ); @@ -356,12 +360,12 @@ class SpecialImport extends SpecialPage { Xml::closeElement( 'fieldset' ) ); } else { - if ( empty( $importSources ) ) { + if ( empty( $this->importSources ) ) { $out->addWikiMsg( 'importnosources' ); } } - if ( $user->isAllowed( 'import' ) && !empty( $importSources ) ) { + if ( $user->isAllowed( 'import' ) && !empty( $this->importSources ) ) { # Show input field for import depth only if $wgExportMaxLinkDepth > 0 $importDepth = ''; if ( $this->getConfig()->get( 'ExportMaxLinkDepth' ) > 0 ) { @@ -403,7 +407,7 @@ class SpecialImport extends SpecialPage { ); $needSubprojectField = false; - foreach ( $importSources as $key => $value ) { + foreach ( $this->importSources as $key => $value ) { if ( is_int( $key ) ) { $key = $value; } elseif ( $value !== $key ) { @@ -435,7 +439,7 @@ class SpecialImport extends SpecialPage { ); $subprojectsToAdd = array(); - foreach ( $importSources as $key => $value ) { + foreach ( $this->importSources as $key => $value ) { if ( is_array( $value ) ) { $subprojectsToAdd = array_merge( $subprojectsToAdd, $value ); }